package study.stream.生成无限流;

import study.User;

import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @Author 刘伟涛
 * @Date 2023/6/28 17:11
 **/
public class Demo02 {
    public static void main(String[] args) {
        IntStream limit = IntStream.iterate(0, n -> n + 2).limit(10);
        System.out.println(limit.mapToObj(User::new).collect(Collectors.toList()));
    }
}
